﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace BattleFury.Lib.Sprites
{
	public class Sprite
		: ISprite
	{
		public virtual Texture2D Texture { get; set; }
		public Vector2 Position { get; set; }
		public Color Tint { get; set; }
		public bool IsVisible { get; set; }
		public bool IsEnabled { get; set; }
		public float Opacity { get; set; }
		public virtual Vector2 Size { get; set; }

		public Rectangle Bounds
		{
			get
			{
				return new Rectangle((int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y);
			}
		}

		public virtual void Update(GameTime gameTime)
		{
			if (!IsEnabled) return;
		}

		public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch)
		{
			if (!IsVisible) return;
			spriteBatch.Draw(Texture, Position, Tint);
		}

		public virtual void Draw(GameTime gameTime)
		{
			if (!IsVisible) return;
			var spriteBatch = RenderEngine.Get().SpriteBatch;
			spriteBatch.Draw(Texture, Position, Tint);
		}
	}
}